import { MessageManager } from '@/entity/MessageManager.class.js';
const ChatMixin = {
	data() {
		return {
			messageManager: new MessageManager(),
			options: {},
			logList: [],
			scrollTop: null,
			scrollOld: 0,
			navBarBackground: {
				background: 'linear-gradient(180deg,rgba(237,79,93,1) 0%,rgba(251,122,142,1) 100%)'
			},
			navBarTitle: '',
			menuList: [{ title: '撤回' }],
			menuPos: { x: 0, y: 0 }
		}
	},
	methods: {
		onScroll(e) {
			this.$u.debounce(() => {
				this.scrollOld = e.detail.scrollTop;
			}, 1000);
		},

		scrollToBottom() {
			setTimeout(() => {
				this.$u.getRect('#chatLogList').then(res => {
					this.scrollTop = this.scrollOld;
					this.$nextTick(() => {
						this.scrollTop = res.height;
					})
				});
			}, 400);
		},
	}

}

export default ChatMixin;
